class TimeUtils{
  //获取当前时间戳
  static int getcurrentTimeMillis() {
    return  DateTime.now().millisecondsSinceEpoch;
  }

  static String getDate({String format="YYYYMMDDHHmmss"}) {
    var date =  DateTime.now();
    format = format.replaceFirst("YYYY", date.year.toString());
    format = format.replaceFirst("MM", date.month.toString().padLeft(2, '0'));
    format = format.replaceFirst("DD", date.day.toString().padLeft(2, '0'));
    format = format.replaceFirst("HH", date.hour.toString().padLeft(2, '0'));
    format = format.replaceFirst("mm", date.minute.toString().padLeft(2, '0'));
    format = format.replaceFirst("ss", date.second.toString().padLeft(2, '0'));
    return format;
  }



  static String getTime({String format = "HHmmss"}) {
    var date =  DateTime.now();
    format = format.replaceFirst("HH", date.hour.toString().padLeft(2, '0'));
    format = format.replaceFirst("mm", date.minute.toString().padLeft(2, '0'));
    format = format.replaceFirst("ss", date.second.toString().padLeft(2, '0'));
    return format;
  }


}